<template>
  <div class="technologydataEdit">
    <!-- <div class="technologydataEdit-top">
      <div class="technologydataEdit-top-img">
        <el-image
          :src="row.img"
          fit="fill"
          :lazy="true"
        ></el-image>
      </div>
      <div class="technologydataEdit-top-content">
        <div>品名：{{row.name}}</div>
        <div>{{row.number}}</div>
      </div>
    </div> -->

    <div class="technologydataEdit-content">
      <div class="technologydataEdit-content-tabs">
        <el-tabs v-model="activeName">
          <el-tab-pane label="工艺单相关文件" name="first">
            <processreport
              :type_no="row.number"
              :id="row.id"
              :disabled="row.sealed_status == 1"
              :isClick="isClick"
            ></processreport>
          </el-tab-pane>
          <el-tab-pane label="封样报告相关文件" name="second">
            <processreportsample
              :type_no="row.number"
              :id="row.id"
              :disabled="row.sealed_status == 1"
              :isClick="isClick"
            ></processreportsample>
          </el-tab-pane>
        </el-tabs>
      </div>

      <div class="technologydataEdit-content-button" v-if="isClick==2">
        <el-button
          type="danger"
          v-if="row.sealed_status == 1"
          @click="onIs(row.number, 0)"
          >点击解锁</el-button
        >
        <el-button
          type="primary"
          v-if="row.sealed_status == 0"
          @click="onIs(row.number, 1)"
          >点击锁定</el-button
        >
      </div>
    </div>
  </div>
</template>

<script>
import { postAdminOperateSetlocking } from "@/api";
import processreport from "@/components/processreport.vue";
import processreportsample from "@/components/processreportsample.vue";

export default {
  props: {
    row: "",
    isClick:""
  },
  components: {
    processreport,
    processreportsample,
  },
  data() {
    return {
      activeName: "first",
    };
  },
  mounted() {},
  methods: {
    async onIs(type_no, status) {
      let obj = {
        type_no: type_no,
        type: 3,
        status: status,
      };
      this.$confirm(`确定${status == 0 ? "解锁" : "锁定"}`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(async () => {
          try {
            await postAdminOperateSetlocking(obj);
            this.row.sealed_status = status;
          } catch (error) {}
        })
        .catch(() => {});
    },
  },
};
</script>

<style lang="scss" scoped>
.technologydataEdit {
  .technologydataEdit-top {
    display: flex;
    background: #fff;
    border-radius: 8px;
    padding: 0 25px;
    align-items: center;
    .technologydataEdit-top-img {
      > .el-image {
        width: 60px;
        height: 60px;
        margin-right: 10px;
      }
    }
    .technologydataEdit-top-content {
      > div:nth-child(2) {
        margin-top: 10px;
        font-size: 14px;
        color: #888;
      }
    }
  }
  .technologydataEdit-content {
    // margin-top: 20px;

    background: #fff;
    border-radius: 8px;
    padding: 0 25px;
    display: flex;
    .technologydataEdit-content-tabs {
      width: 100%;
      margin-right: 100px;
      /deep/.el-tabs__item.is-active {
        color: #2c70d6 !important;
        background: none !important;
      }
    }
    .technologydataEdit-content-button {
      border-left: 1px solid #efefef;
      padding: 0 100px;
      padding-top:40px
    }
  }
}
</style>